package com.e3.basdoc.employeecls.service;

import java.util.List;

import com.e3.basdoc.employeecls.model.EmployeeClsModel;
import com.e3.core.base.ModelCacheManager;
import com.e3.core.cache.CacheManager;

public class EmployeeClsCacheManager extends ModelCacheManager<EmployeeClsModel>{
	
	public final static String EMPLOYEECLASSES_CACHE = CacheManager.DEFAULT_LRU_CACHE;
	
	public static EmployeeClsCacheManager INSTANCE = new EmployeeClsCacheManager();
	
	public void put(EmployeeClsModel model){
		putModel(EMPLOYEECLASSES_CACHE, model);
		Long pId = model.getParentId();
		if(pId!=null&&pId>0){
			EmployeeClsModel pModel = get(pId);
			pModel.setHasChildren(true);
		}
	}

	public EmployeeClsModel get(Long id) {
		return getModel(EMPLOYEECLASSES_CACHE, id);
	}
	
	public void remove(List<Long> ids){
		removeModels(EMPLOYEECLASSES_CACHE,ids);
	}

}
